﻿/*
 * 由SharpDevelop创建。
 * 用户： Dell
 * 日期: 2016/3/25
 * 时间: 21:35
 * 
 * 要改变这种模板请点击 工具|选项|代码编写|编辑标准头文件
 */
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;

namespace jisuanqi
{
	/// <summary>
	/// Description of MainForm.
	/// </summary>
	public partial class MainForm : Form
	{
		public MainForm()
		{
			//
			// The InitializeComponent() call is required for Windows Forms designer support.
			//
			InitializeComponent();
			
			//
			// TODO: Add constructor code after the InitializeComponent() call.
			//
		}
		Boolean equal=false;
		private int num1,num2,op;
		
		
		void Button1Click(object sender, EventArgs e)
		{
			if(equal==true)
			{
				textBox1.Text=" ";
				equal=false;
			}
			textBox1.Text+="1";
		}
		
		void Button11Click(object sender, EventArgs e)
		{
			if(equal==true)
			{
				textBox1.Text=" ";
				equal=false;
			}
			textBox1.Text+="2";
		}
		
		void Button10Click(object sender, EventArgs e)
		{
			if(equal==true)
			{
				textBox1.Text=" ";
				equal=false;
			}
			textBox1.Text+="3";
		}
		
		void Button8Click(object sender, EventArgs e)
		{
			if(equal==true)
			{
				textBox1.Text=" ";
				equal=false;
			}
			textBox1.Text+="4";
		}
		
		void Button2Click(object sender, EventArgs e)
		{
			if(equal==true)
			{
				textBox1.Text=" ";
				equal=false;
			}
			textBox1.Text+="5";
		}
		
		void Button13Click(object sender, EventArgs e)
		{
			if(equal==true)
			{
				textBox1.Text=" ";
				equal=false;
			}
			textBox1.Text+="6";
		}
		
		void Button4Click(object sender, EventArgs e)
		{
			if(equal==true)
			{
				textBox1.Text=" ";
				equal=false;
			}
			textBox1.Text+="7";
		}
		
		void Button17Click(object sender, EventArgs e)
		{
			if(equal==true)
			{
				textBox1.Text=" ";
				equal=false;
			}
			textBox1.Text+="8";
		}
		
		void Button14Click(object sender, EventArgs e)
		{
			if(equal==true)
			{
				textBox1.Text=" ";
				equal=false;
			}
			textBox1.Text+="9";
		}
		
		void Button16Click(object sender, EventArgs e)
		{
			if(equal==true)
			{
				textBox1.Text=" ";
				equal=false;
			}
			textBox1.Text+="0";
		}
		

		
		void Button3Click(object sender, EventArgs e)
		{
			if(equal==true)
			{
				textBox1.Text=" ";
				equal=false;
			}
			textBox1.Text+=".";
		}
		
		void Button9Click(object sender, EventArgs e)
		{
			num1=Convert.ToInt16(textBox1.Text);
			textBox1.Text="";
			op=1;
		}
		
		void Button15Click(object sender, EventArgs e)
		{   num2=Convert.ToInt16(textBox1.Text);
			switch(op){
				case 1:
					textBox1.Text=Convert.ToString(num1+num2);
					break;
				case 2:
					textBox1.Text=Convert.ToString(num1-num2);
					break;
				case 3:
					textBox1.Text=Convert.ToString(num1*num2);
					break;
				case 4:
					textBox1.Text=Convert.ToString(num1/num2);
					break;
				default:
					break;
					
			}
		}
		
		void Button7Click(object sender, EventArgs e)
		{
			num1=Convert.ToInt16(textBox1.Text);
			textBox1.Text="";
			op=2;
				
		}
		
		void Button6Click(object sender, EventArgs e)
		{
			num1=Convert.ToInt16(textBox1.Text);
			textBox1.Text="";
			op=3;
		}
		
		void Button5Click(object sender, EventArgs e)
		{
			num1=Convert.ToInt16(textBox1.Text);
			textBox1.Text="";
			op=4;
		}
		
		void Label1Click(object sender, EventArgs e)
		{
			
		}
		
		void Button12Click(object sender, EventArgs e)
		{
			textBox1.Text=" ";
		}
	}
}
